import Vue from 'vue'
import Router from 'vue-router'

// 二维码扫描
const scanQRCode = resolve => require(['../components/scan/scanQRCode.vue'], resolve)

// 在线批发商城
const home = resolve => require(['../components/wholesale/home.vue'], resolve)

const goodsDetail = resolve => require(['../components/wholesale/goods/goodsDetail.vue'], resolve)
const goodsList = resolve => require(['../components/wholesale/goods/goodsList.vue'], resolve)

// 管理
const goodsAdmin = resolve => require(['../components/wholesale/goods/admin/goodsAdmin.vue'], resolve)

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: home
    },
    {
      path: '/scan',
      name: 'scanQRCode',
      component: scanQRCode
    },
    {
      path: '/wholesale',
      component: home,
      children: [
        {
          path: 'goodsList',
          component: goodsList
        },
        {
          path: 'goodsinfo/:id',
          component: goodsDetail
        }
      ]
    },
    {
      path: '/admin',
      component: home,
      children: [
        {
          path: 'goodsinfo/:id',
          component: goodsAdmin
        }
      ]
    }
  ]
})
